/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.cservice.a;

import android.content.Context;
import android.content.Intent;
import com.qihoo.gamecenter.sdk.common.a.c;
import com.qihoo.gamecenter.sdk.common.i.f;
import com.qihoo.gamecenter.sdk.common.i.s;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.message.BasicNameValuePair;

public class b extends com.qihoo.gamecenter.sdk.common.h.a {
    private com.qihoo.gamecenter.sdk.common.c.a f;
    private Context g;

    public b(Context paramContext, Intent paramIntent) {
        super(paramContext, paramIntent);
        this.g = paramContext;
        this.f = com.qihoo.gamecenter.sdk.common.c.a.a(paramContext);
    }

    protected String a(String[] paramArrayOfString) {
        if (a())
            return c(paramArrayOfString);
        return b(paramArrayOfString);
    }

    protected boolean a() {
        return true;
    }

    private String b(String[] paramArrayOfString) {
        UrlEncodedFormEntity localUrlEncodedFormEntity = null;
        try {
            ArrayList localArrayList = new ArrayList();
            String str = c.c();
            localArrayList.add(new BasicNameValuePair("app_key", s.r(this.g)));
            localArrayList.add(new BasicNameValuePair("user_id", str));
            localArrayList.add(new BasicNameValuePair("contact", a(paramArrayOfString, 0)));
            localArrayList.add(new BasicNameValuePair("question", a(paramArrayOfString, 1)));
            localUrlEncodedFormEntity = new UrlEncodedFormEntity(localArrayList, "UTF-8");
        } catch (UnsupportedEncodingException localUnsupportedEncodingException) {
            com.qihoo.gamecenter.sdk.support.g.a.c("PostFeedbackTask",
                    new Object[] { localUnsupportedEncodingException.toString() });
        }
        this.f.a(c.g());
        return this.f.a("http://mgame.360.cn/feedback/add?", localUrlEncodedFormEntity);
    }

    private String c(String[] paramArrayOfString) {
        UrlEncodedFormEntity localUrlEncodedFormEntity = null;
        try {
            StringBuilder localStringBuilder = new StringBuilder();
            localStringBuilder.append("app_key=").append(s.r(this.g));
            localStringBuilder.append("&user_id=").append(c.c());
            localStringBuilder.append("&contact=").append(URLEncoder.encode(a(paramArrayOfString, 0)));
            localStringBuilder.append("&question=").append(URLEncoder.encode(a(paramArrayOfString, 1)));
            this.e = s.b();
            String str1 = f.c(localStringBuilder.toString(), this.e);
            String str2 = com.qihoo.gamecenter.sdk.common.f.b.a().a(this.e);
            ArrayList localArrayList = new ArrayList();
            localArrayList.add(new BasicNameValuePair("k", str2));
            localArrayList.add(new BasicNameValuePair("d", str1));
            localUrlEncodedFormEntity = new UrlEncodedFormEntity(localArrayList, "UTF-8");
        } catch (UnsupportedEncodingException localUnsupportedEncodingException) {
            com.qihoo.gamecenter.sdk.support.g.a.b("PostFeedbackTask",
                    new Object[] { localUnsupportedEncodingException.toString() });
        }
        this.f.a(c.g());
        return this.f.a("http://mgame.360.cn/feedback/add_v2?", localUrlEncodedFormEntity, this.e);
    }
}